home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / Amiga-E / E_v3.2a_extras / PdSrc / Lang / Yax / sincosdemo.yax < prev    next >
Lisp/Scheme  |  1992-09-02  |  3KB  |  67 lines

  1. /* SinCosDemo.yax freeware v0.4 @ Ben Schaeffer1993 
  2. Sine and cosine arrays in degrees, 0 to 360 inclusive. */
  3.  
  4. /* modified by wouter */
  5.  
  6. (array sin 361
  7.  0 4 9 13 18 22 27 31 36 40 44 49 53 58 62 66 71 75 79 83 88 92 96 100 104 108
  8.  112 116 120 124 128 132 136 139 143 147 150 154 158 161 165 168 171 175 178
  9.  181 184 187 190 193 196 199 202 204 207 210 212 215 217 219 222 224 226 228
  10.  230 232 234 236 237 239 241 242 243 245 246 247 248 249 250 251 252 253 254
  11.  254 255 255 255 256 256 256 256 256 256 256 255 255 255 254 254 253 252 251
  12.  250 249 248 247 246 245 243 242 241 239 237 236 234 232 230 228 226 224 222
  13.  219 217 215 212 210 207 204 202 199 196 193 190 187 184 181 178 175 171 168
  14.  165 161 158 154 150 147 143 139 136 132 128 124 120 116 112 108 104 100 96
  15.  92 88 83 79 75 71 66 62 58 53 49 44 40 36 31 27 22 18 13 9 4 0
  16.  -4 -9 -13 -18 -22 -27 -31 -36 -40 -44 -49 -53 -58 -62 -66 -71 -75 -79 -83
  17.  -88 -92 -96 -100 -104 -108 -112 -116 -120 -124 -128 -132 -136 -139 -143 -147
  18.  -150 -154 -158 -161 -165 -168 -171 -175 -178 -181 -184 -187 -190 -193 -196
  19.  -199 -202 -204 -207 -210 -212 -215 -217 -219 -222 -224 -226 -228 -230 -232
  20.  -234 -236 -237 -239 -241 -242 -243 -245 -246 -247 -248 -249 -250 -251 -252
  21.  -253 -254 -254 -255 -255 -255 -256 -256 -256 -256 -256 -256 -256 -255 -255
  22.  -255 -254 -254 -253 -252 -251 -250 -249 -248 -247 -246 -245 -243 -242 -241
  23.  -239 -237 -236 -234 -232 -230 -228 -226 -224 -222 -219 -217 -215 -212 -210
  24.  -207 -204 -202 -199 -196 -193 -190 -187 -184 -181 -178 -175 -171 -168 -165
  25.  -161 -158 -154 -150 -147 -143 -139 -136 -132 -128 -124 -120 -116 -112 -108
  26.  -104 -100 -96 -92 -88 -83 -79 -75 -71 -66 -62 -58 -53 -49 -44 -40 -36 -31 -27
  27.  -22 -18 -13 -9 -4  0
  28. )
  29.  
  30. (defun cos (a) (sin (if (> a 270) (- a 270) (+ a 90))))
  31. (defun wait () (while (uneq (mouse) 0)))
  32.  
  33. (window 0 0 600 180 'circle')
  34.  
  35. (for n 0 360
  36.    (line (+ 300 (/ (* 160 (cos n)) 256))
  37.          (+ 95 (/ (* 75 (sin n)) 256))
  38.          (+ 300 (/ (* 80 (cos n)) 256)) 
  39.          (+ 95 (/ (* 37 (sin n)) 256)) n)
  40. )
  41.  
  42. (for n 0 360
  43.    (plot (+ 300 (/ (* 40 (cos n)) 256)) (+ 95 (/ (* 19 (sin n)) 256)) n)
  44. )
  45.  
  46. (write 'click to continue')
  47. (wait)
  48. (while (eq (mouse) 0))
  49. (cls)
  50. (set m 181)
  51. (wait)
  52. (while (eq (mouse) 0)
  53.   (for n 0 360
  54.      (line (+ 300 (/ (* 160 (cos n)) 256))
  55.            (+ 95 (/ (* 75 (sin (- 360 n))) 256)) 
  56.            (+ 300 (/ (* 80 (cos n)) 256)) 
  57.            (+ 95 (/ (* 37 (sin n)) 256)) 2)
  58.      (line (+ 300 (/ (* 160 (cos m)) 256)) 
  59.            (+ 95 (/ (* 75 (sin (- 360 m))) 256)) 
  60.            (+ 300 (/ (* 80 (cos m)) 256)) 
  61.            (+ 95 (/ (* 37 (sin m)) 256)) 1)
  62.      (set m (+ m 1))
  63.      (if (eq m 361) (set m 0))
  64.      (if (uneq (mouse) 0) (exit))
  65.   )
  66. )
  67.